package org.wwb.antbox.user.iservice;

import org.ant.dubbo.consumer.AbstractServiceTool;
import org.wwb.antbox.user.iservice.menu.ISysMenuService;
import org.wwb.antbox.user.iservice.passport.IPassportService;
import org.wwb.antbox.user.iservice.role.ISysRoleService;
import org.wwb.antbox.user.iservice.rolemenu.ISysRoleMenuService;
import org.wwb.antbox.user.iservice.system.ISysSystemService;
import org.wwb.antbox.user.iservice.user.ISysUserService;
import org.wwb.antbox.user.iservice.userrole.ISysUserRoleService;

/**
 * @Author Bond
 * @Date: 19-8-27 17:07
 * @Description: ServiceUserTool
 */
public class ServiceUserTool extends AbstractServiceTool {

    /**
     * dubbo 应用名称
     */
    private static String dubboApplicationNamePropertyName = "org.ant.boot.dubbo.application.name";

    @Override
    public Class<?> getServiceToolClass() {
        return this.getClass();
    }

    @Override
    public String getDubboApplicationNamePropertyName() {
        return dubboApplicationNamePropertyName;
    }

    /**
     * 根据类型获取对应接口的服务
     * @param interfaceClazz
     * @param <T>
     * @return
     */
    public static <T> T getService(Class<T> interfaceClazz){
        return getService(ServiceUserTool.class,interfaceClazz);
    }


    /**
     * 系统用户接口
     * @return ISysUserService
     */
    public static ISysUserService sysUserService(){
        return getService(ServiceUserTool.class, ISysUserService.class);
    }

    /**
     * 系统接口
     * @return ISysSystemService
     */
    public static ISysSystemService sysSystemService(){
        return getService(ServiceUserTool.class, ISysSystemService.class);
    }

    /**
     * 系统角色接口
     * @return ISysRoleService
     */
    public static ISysRoleService sysRoleService(){
        return getService(ServiceUserTool.class, ISysRoleService.class);
    }

    /**
     * 系统用户角色关系接口
     * @return ISysUserRoleService
     */
    public static ISysUserRoleService sysUserRoleService(){
        return getService(ServiceUserTool.class, ISysUserRoleService.class);
    }

    /**
     * 系统菜单接口
     * @return ISysMenuService
     */
    public static ISysMenuService sysMenuService(){
        return getService(ServiceUserTool.class, ISysMenuService.class);
    }

    /**
     * 角色菜单关系接口
     * @return ISysRoleMenuService
     */
    public static ISysRoleMenuService sysRoleMenuService(){
        return getService(ServiceUserTool.class, ISysRoleMenuService.class);
    }

    /**
     * 用户登录相关服务接口
     * @return IPassportService
     */
    public static IPassportService passportService(){
        return getService(ServiceUserTool.class, IPassportService.class);
    }

}
